home *** CD-ROM | disk | FTP | other *** search
- Path: fido.asd.sgi.com!austern
- From: jsa@edg.com (J. Stephen Adamczyk)
- Newsgroups: comp.std.c++
- Subject: Re: 'const' binding to specifier in declaration list
- Date: 17 Apr 1996 11:31:42 PDT
- Organization: Edison Design Group Inc.
- Approved: austern@isolde.mti.sgi.com
- Message-ID: <Dq0qGt.8Kz@edg.com>
- References: <3173B383.41C67EA6@rstcorp.com> <KANZE.96Apr17121453@slsvgqt.lts.sel.alcatel.de>
- NNTP-Posting-Host: isolde.mti.sgi.com
- X-Original-Date: Wed, 17 Apr 1996 18:10:04 GMT
- Apparently-To: comp-std-c++@uunet.uu.net
- X-Auth: PGPMoose V1.1 PGP comp.std.c++
- iQBVAwUBMXU5D0y4NqrwXLNJAQFP7QIAxipo1dcPyyfEMpXxR49mu1LNhBW06SYs
- NjEVMR8Qa2THd5JRqBlWX1njXmR5vaBH9R9VaAnF/pX8kq6WBeFcPg==
- =rmNV
- Originator: austern@isolde.mti.sgi.com
-
- In article <KANZE.96Apr17121453@slsvgqt.lts.sel.alcatel.de> kanze@lts.sel.alcatel.de (James Kanze US/ESC 60/3/141 #40763) writes:
- >In article <3173B383.41C67EA6@rstcorp.com> "Aaron S. Binns"
- ><asbinn@rstcorp.com> writes:
- >|> I recently came across a piece of code that reads:
- >
- >|> class A {
- >|> // contents of class A
- >|> } a1, *a2, const *a3;
- >
- >While I personally wouldn't write anything like this, it is definitly
- >legal.
-
- No, I'm sorry, that's not true. This little syntactic oddity is something
- accepted by the Microsoft compiler, but it's not standard C or C++.
- The part that gets repeated in a declaration comma list is the declarator,
- and the cv-qualifiers can only appear following a pointer or pointer-to-member
- declarator in the declarator syntax.
-
- A little research with the Microsoft compiler suggests that:
-
- int i, const j, const *k; // Declares j as "const int", k as "int *"
-
- So the "const" above does nothing. But that is outside the scope of
- comp.std.c++.
-
- Steve Adamczyk
- Edison Design Group
- ---
- [ comp.std.c++ is moderated. To submit articles: Try just posting with your
- newsreader. If that fails, use mailto:std-c++@ncar.ucar.edu
- comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
- Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
- Comments? mailto:std-c++-request@ncar.ucar.edu
- ]
-